import 'package:flutter_taotaoshipin/generated/json/base/json_convert_content.dart';
import 'package:flutter_taotaoshipin/model/user_open_entity.dart';

UserOpenEntity $UserOpenEntityFromJson(Map<String, dynamic> json) {
  final UserOpenEntity userOpenEntity = UserOpenEntity();
  final int? status = jsonConvert.convert<int>(json['status']);
  if (status != null) {
    userOpenEntity.status = status;
  }
  final int? isOwn = jsonConvert.convert<int>(json['is_own']);
  if (isOwn != null) {
    userOpenEntity.isOwn = isOwn;
  }
  final int? clientId = jsonConvert.convert<int>(json['client_id']);
  if (clientId != null) {
    userOpenEntity.clientId = clientId;
  }
  final String? clientCode = jsonConvert.convert<String>(json['client_code']);
  if (clientCode != null) {
    userOpenEntity.clientCode = clientCode;
  }
  final int? auto = jsonConvert.convert<int>(json['auto']);
  if (auto != null) {
    userOpenEntity.auto = auto;
  }
  final String? userName = jsonConvert.convert<String>(json['user_name']);
  if (userName != null) {
    userOpenEntity.userName = userName;
  }
  final String? userPwd = jsonConvert.convert<String>(json['user_pwd']);
  if (userPwd != null) {
    userOpenEntity.userPwd = userPwd;
  }
  final String? appKey = jsonConvert.convert<String>(json['app_key']);
  if (appKey != null) {
    userOpenEntity.appKey = appKey;
  }
  final UserOpenCsj? csj = jsonConvert.convert<UserOpenCsj>(json['csj']);
  if (csj != null) {
    userOpenEntity.csj = csj;
  }
  return userOpenEntity;
}

Map<String, dynamic> $UserOpenEntityToJson(UserOpenEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['status'] = entity.status;
  data['is_own'] = entity.isOwn;
  data['client_id'] = entity.clientId;
  data['client_code'] = entity.clientCode;
  data['auto'] = entity.auto;
  data['user_name'] = entity.userName;
  data['user_pwd'] = entity.userPwd;
  data['app_key'] = entity.appKey;
  data['csj'] = entity.csj?.toJson();
  return data;
}

extension UserOpenEntityExtension on UserOpenEntity {
  UserOpenEntity copyWith({
    int? status,
    int? isOwn,
    int? clientId,
    String? clientCode,
    int? auto,
    String? userName,
    String? userPwd,
    String? appKey,
    UserOpenCsj? csj,
  }) {
    return UserOpenEntity()
      ..status = status ?? this.status
      ..isOwn = isOwn ?? this.isOwn
      ..clientId = clientId ?? this.clientId
      ..clientCode = clientCode ?? this.clientCode
      ..auto = auto ?? this.auto
      ..userName = userName ?? this.userName
      ..userPwd = userPwd ?? this.userPwd
      ..appKey = appKey ?? this.appKey
      ..csj = csj ?? this.csj;
  }
}

UserOpenCsj $UserOpenCsjFromJson(Map<String, dynamic> json) {
  final UserOpenCsj userOpenCsj = UserOpenCsj();
  final String? appId = jsonConvert.convert<String>(json['app_id']);
  if (appId != null) {
    userOpenCsj.appId = appId;
  }
  final String? appName = jsonConvert.convert<String>(json['app_name']);
  if (appName != null) {
    userOpenCsj.appName = appName;
  }
  final String? codeId = jsonConvert.convert<String>(json['code_id']);
  if (codeId != null) {
    userOpenCsj.codeId = codeId;
  }
  final int? num = jsonConvert.convert<int>(json['num']);
  if (num != null) {
    userOpenCsj.num = num;
  }
  final List<UserOpenCsjList>? list = (json['list'] as List<dynamic>?)
      ?.map(
          (e) => jsonConvert.convert<UserOpenCsjList>(e) as UserOpenCsjList)
      .toList();
  if (list != null) {
    userOpenCsj.list = list;
  }
  return userOpenCsj;
}

Map<String, dynamic> $UserOpenCsjToJson(UserOpenCsj entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['app_id'] = entity.appId;
  data['app_name'] = entity.appName;
  data['code_id'] = entity.codeId;
  data['num'] = entity.num;
  data['list'] = entity.list?.map((v) => v.toJson()).toList();
  return data;
}

extension UserOpenCsjExtension on UserOpenCsj {
  UserOpenCsj copyWith({
    String? appId,
    String? appName,
    String? codeId,
    int? num,
    List<UserOpenCsjList>? list,
  }) {
    return UserOpenCsj()
      ..appId = appId ?? this.appId
      ..appName = appName ?? this.appName
      ..codeId = codeId ?? this.codeId
      ..num = num ?? this.num
      ..list = list ?? this.list;
  }
}

UserOpenCsjList $UserOpenCsjListFromJson(Map<String, dynamic> json) {
  final UserOpenCsjList userOpenCsjList = UserOpenCsjList();
  final String? adverId = jsonConvert.convert<String>(json['adver_id']);
  if (adverId != null) {
    userOpenCsjList.adverId = adverId;
  }
  final String? adverType = jsonConvert.convert<String>(json['adver_type']);
  if (adverType != null) {
    userOpenCsjList.adverType = adverType;
  }
  return userOpenCsjList;
}

Map<String, dynamic> $UserOpenCsjListToJson(UserOpenCsjList entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['adver_id'] = entity.adverId;
  data['adver_type'] = entity.adverType;
  return data;
}

extension UserOpenCsjListExtension on UserOpenCsjList {
  UserOpenCsjList copyWith({
    String? adverId,
    String? adverType,
  }) {
    return UserOpenCsjList()
      ..adverId = adverId ?? this.adverId
      ..adverType = adverType ?? this.adverType;
  }
}